package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

/**
 * 功能类型表
 */
@Entity
@Table(name = "function_type", schema = "lxh_crm", catalog = "")
public class FunctionType {
    private int functionTypeId;
    private String funTypeName;
    private String funTypeIcon;
    private Integer typeSort;
    private Integer isShow;
    private String funTypePath;
    private List<Department> departments;
    /*功能类型对部门  多对多*/
    @ManyToMany(mappedBy = "funType")
    public List<Department> getDepartments() {
        return departments;
    }
    public void setDepartments(List<Department> departments) {
        this.departments = departments;
    }
    /* *//*权限组对权限  一对多*/
    private List<Function> funS;
    @OneToMany(mappedBy = "functionType")
    public List<Function> getFunS() {
        return funS;
    }
    public void setFunS(List<Function> funS) {
        this.funS = funS;
    }

    @Id
    @Column(name = "function_type_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getFunctionTypeId() {
        return functionTypeId;
    }

    public void setFunctionTypeId(int functionTypeId) {
        this.functionTypeId = functionTypeId;
    }

    @Basic
    @Column(name = "fun_type_name", nullable = true, length = 40)
    public String getFunTypeName() {
        return funTypeName;
    }

    public void setFunTypeName(String funTypeName) {
        this.funTypeName = funTypeName;
    }

    @Basic
    @Column(name = "fun_type_icon", nullable = true, length = 40)
    public String getFunTypeIcon() {
        return funTypeIcon;
    }

    public void setFunTypeIcon(String funTypeIcon) {
        this.funTypeIcon = funTypeIcon;
    }

    @Basic
    @Column(name = "type_sort", nullable = true)
    public Integer getTypeSort() {
        return typeSort;
    }

    public void setTypeSort(Integer typeSort) {
        this.typeSort = typeSort;
    }

    @Basic
    @Column(name = "is_show", nullable = true)
    public Integer getIsShow() {
        return isShow;
    }

    public void setIsShow(Integer isShow) {
        this.isShow = isShow;
    }

    public String getFunTypePath() {
        return funTypePath;
    }

    public void setFunTypePath(String funTypePath) {
        this.funTypePath = funTypePath;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FunctionType that = (FunctionType) o;
        return functionTypeId == that.functionTypeId &&
                Objects.equals(funTypeName, that.funTypeName) &&
                Objects.equals(funTypeIcon, that.funTypeIcon) &&
                Objects.equals(typeSort, that.typeSort) &&
                Objects.equals(isShow, that.isShow);
    }

    @Override
    public int hashCode() {
        return Objects.hash(functionTypeId, funTypeName, funTypeIcon, typeSort, isShow);
    }
}
